/*
 *  Copyright 2008 Danny Lagrouw
 *  
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *  
 *      http://www.apache.org/licenses/LICENSE-2.0
 *  
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License. 
 */
package org.bastion.db4o.init;

import org.bastion.adapter.FindAdapter;
import org.bastion.adapter.QueryAdapter;
import org.bastion.adapter.RegisterAdapter;
import org.bastion.db4o.service.Db4oService;
import org.bastion.domain.Domain;
import org.bastion.init.DomainBootstrap;
import org.bastion.message.FindMessage;
import org.bastion.message.QueryMessage;
import org.bastion.message.RegisterMessage;

import com.db4o.ObjectContainer;


public class Db4oBootstrap extends DomainBootstrap {

	private final ObjectContainer db;

	public Db4oBootstrap(Domain domain, ObjectContainer db) {
		super(domain);
		this.db = db;
	}

	@Override
	protected void registerAdapters() {
		super.registerAdapters();
		Db4oService service = new Db4oService(db);
		getDomain().registerAdapter(RegisterMessage.class, new RegisterAdapter(service));
		getDomain().registerAdapter(FindMessage.class, new FindAdapter(service));
		getDomain().registerAdapter(QueryMessage.class, new QueryAdapter(service));
	}
	
}
